package com.member.shop.service.impl;

import java.util.Arrays;
import java.util.List;

import com.member.common.utils.DateUtils;

import javax.annotation.Resource;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.stereotype.Service;
import com.member.shop.mapper.SysBizOftenBuyMapper;
import com.member.shop.domain.SysBizOftenBuy;
import com.member.shop.service.ISysBizOftenBuyService;

/**
 * 常买清单Service业务层处理
 *
 * @author lixinchen
 * @date 2025-01-11
 */
@Service
public class SysBizOftenBuyServiceImpl extends ServiceImpl<SysBizOftenBuyMapper, SysBizOftenBuy> implements ISysBizOftenBuyService {
    @Resource
    private SysBizOftenBuyMapper sysBizOftenBuyMapper;

    /**
     * 查询常买清单
     *
     * @param id 常买清单主键
     * @return 常买清单
     */
    @Override
    public SysBizOftenBuy selectSysBizOftenBuyById(Long id) {
        return sysBizOftenBuyMapper.selectById(id);
    }

    /**
     * 查询常买清单列表
     *
     * @param queryWrapper 常买清单
     * @return 常买清单
     */
    @Override
    public List<SysBizOftenBuy> selectSysBizOftenBuyList(LambdaQueryWrapper<SysBizOftenBuy> queryWrapper) {
        return sysBizOftenBuyMapper.selectList(queryWrapper);
    }

    @Override
    public List<SysBizOftenBuy> selectSysBizOftenBuyList(SysBizOftenBuy sysBizOftenBuy) {
        return sysBizOftenBuyMapper.selectSysBizOftenBuyList(sysBizOftenBuy);
    }

    /**
     * 新增常买清单
     *
     * @param sysBizOftenBuy 常买清单
     * @return 结果
     */
    @Override
    public int insertSysBizOftenBuy(SysBizOftenBuy sysBizOftenBuy) {
        sysBizOftenBuy.setCreateTime(DateUtils.getNowDate());
        return sysBizOftenBuyMapper.insert(sysBizOftenBuy);
    }

    /**
     * 修改常买清单
     *
     * @param sysBizOftenBuy 常买清单
     * @return 结果
     */
    @Override
    public int updateSysBizOftenBuy(SysBizOftenBuy sysBizOftenBuy) {
        sysBizOftenBuy.setUpdateTime(DateUtils.getNowDate());
        return sysBizOftenBuyMapper.updateById(sysBizOftenBuy);
    }

    /**
     * 批量删除常买清单
     *
     * @param ids 需要删除的常买清单主键
     * @return 结果
     */
    @Override
    public int deleteSysBizOftenBuyByIds(Long[] ids) {
        return sysBizOftenBuyMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除常买清单信息
     *
     * @param id 常买清单主键
     * @return 结果
     */
    @Override
    public int deleteSysBizOftenBuyById(Long id) {
        return sysBizOftenBuyMapper.deleteById(id);
    }
}
